Skip to content

fix(spark): resolve vortex.workerThreads case-insensitively - #9170

Open
jackylee-ch wants to merge 1 commit into
vortex-data:developfrom
jackylee-ch:spark-worker-threads-option
Open

fix(spark): resolve vortex.workerThreads case-insensitively#9170
jackylee-ch wants to merge 1 commit into
vortex-data:developfrom
jackylee-ch:spark-worker-threads-option

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

A read option set as vortex.workerThreads never reached the native runtime.

VortexTable.newScanBuilder merges the CaseInsensitiveStringMap Spark hands it into the format options. That map lower-cases its keys in the constructor and entrySet() returns the lower-cased delegate, so the option arrives spelled vortex.workerthreads — while VortexScanBuilder seeds the camelCase spelling with the default of 4. Both keys end up in the map and the case-sensitive getOrDefault always read the default one, silently ignoring the user's value.

Also validates the value. It was a bare Integer.parseInt, so a non-numeric value failed inside the executor task with NumberFormatException: For input string: "eight" — naming neither the option nor the accepted range — and a negative value only failed later in the native runtime.

Tests

New VortexPartitionReaderFactoryTest (JVM-only, no session): default, camelCase key, lower-cased key, zero, whitespace, non-numeric and negative.

  • ./gradlew :vortex-spark_2.13:test --tests 'dev.vortex.spark.read.VortexPartitionReaderFactoryTest' — 7/7 pass
  • ./gradlew :vortex-spark_2.12:test ... — 7/7 pass
  • VortexSqlTest and VortexFilterPushdownTest (both Scala versions) — pass, unchanged
  • spotlessCheck (both) and javadoc — clean

@jackylee-ch
jackylee-ch force-pushed the spark-worker-threads-option branch from 4e741ba to 6f53ef2 Compare August 4, 2026 12:16
@robert3005 robert3005 added the changelog/chore A trivial change label Aug 4, 2026
private static final long serialVersionUID = 1L;

private final ImmutableList<String> dataColumnNames;
private final ImmutableMap<String, String> formatOptions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we can make this a CaseInsensitiveStringMap, and probably go higher in the call stack and start with CaseInsensitiveStringMap wherever those options originate from

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CaseInsensitiveStringMap isn't Serializable, and formatOptions crosses two serialization boundaries — the VortexPartitionReaderFactory field and the VortexFilePartition record component.

How about a small VortexOptions wrapper, along the lines of Spark's own ParquetOptions? FileSourceOptions is Serializable, holds its CaseInsensitiveMap as transient, and resolves the options it needs into plain fields up front — that gets us case-insensitive lookup and serializability at the same time, and gives the options a single home instead of string literals at each call site.

Happy to do it here, or as a follow-up if you'd rather keep this PR to the one-line fix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #9191 with a VortexOptions type along these lines — case-insensitive lookup for every option, Serializable with a transient view like ParquetOptions, threaded through the read and write paths. Leaving this PR as the minimal fix; happy to close it in favour of #9191 if you prefer.

A read option set as vortex.workerThreads never reached the native
runtime. VortexTable.newScanBuilder merges the CaseInsensitiveStringMap
Spark hands it into the format options; that map lower-cases its keys, so
the option arrives spelled vortex.workerthreads while VortexScanBuilder
seeds the camelCase spelling with the default of 4. The case-sensitive
lookup always read the default one, silently ignoring the user's value.

Wrap the options in a CaseInsensitiveStringMap and read through getInt.

Signed-off-by: jackylee <qcsd2011@gmail.com>
@jackylee-ch
jackylee-ch force-pushed the spark-worker-threads-option branch from 6f53ef2 to 02466f9 Compare August 6, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants